import com.bit.demo.UserService;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.core.io.ClassPathResource;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ws
 * Date: 2023-07-18
 * Time: 21:38
 */
public class App2 {
    public static void main(String[] args) {
        //1.得到Spring上下文对象
        BeanFactory factory = new XmlBeanFactory(new ClassPathResource("spring-config.xml"));
        //2.获取Bean
        UserService userService = (UserService) factory.getBean("user");
        //3.使用Bean
        userService.sayHi();

        //Student不会被加载
    }
}
